<%--
  User: Shengzhao Li
  Date: 13-9-8
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="custom" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="displaytag" uri="http://displaytag.sf.net" %>
<html>
<head>
    <title>Backlog</title>
</head>
<body>
<div class="row">
    <hr/>
    <div class="span8">
        <form action="" id="backlogForm" class="form-inline">
            <select name="type" id="backlogTypeSelect">
                <option value="">All types</option>
                <c:forEach items="${backlogOverviewDto.availableTypes}" var="s">
                    <option value="${s}" ${s eq backlogOverviewDto.type?'selected':''}>${s.label}</option>
                </c:forEach>
            </select>
            &nbsp;
            <select name="priority" id="backlogPrioritySelect">
                <option value="">All priorities</option>
                <c:forEach items="${backlogOverviewDto.availablePriorities}" var="s">
                    <option value="${s}" ${s eq backlogOverviewDto.priority?'selected':''}>${s.label}</option>
                </c:forEach>
            </select>
            <button class="btn btn-small" type="submit"><i class="icon-search"></i> Search</button>
        </form>
    </div>
    <div class="span2">
        &nbsp;
    </div>
    <div class="span2">
        <a class="btn btn-success btn-small" href="backlog_form/create"><i
                class="icon-plus icon-white"></i> Create backlog</a>
    </div>

</div>
<div class="row">
    <div class="span12">
        <div class="alert alert-success hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-ok-sign icon-white"></i>
                <span id="successAddBacklog" class="hide">Add/Edit the backlog successful!</span>
            </div>
        </div>
        <div class="alert alert-info hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-info-sign icon-white"></i>
                <span id="archiveBacklogInfo" class="hide">Archive the backlog already finished.!</span>
            </div>
        </div>
        <div class="alert alert-error hide">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <div><i class="icon-warning-sign icon-white"></i>
                <%--<span id="alertErrorInfo"></span>--%>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="span12">
        <displaytag:table list="${backlogOverviewDto}" class="table table-hover table-striped" id="backlog"
                          form="backlogForm">
            <displaytag:column title="Content" headerClass="width60">
                <div class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            ${backlog.content}
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                        <custom:backlog_overview_menu_actions backlog="${backlog}"/>
                    </ul>
                </div>
            </displaytag:column>
            <displaytag:column title="Estimate" property="estimateTime" style="vertical-align: middle;"/>
            <displaytag:column title="Type" property="type.label" style="vertical-align: middle;"/>
            <displaytag:column title="Priority" property="priority.label" style="vertical-align: middle;"
                               class="${backlog.priority}"/>
            <displaytag:column title="Sprint" style="vertical-align: middle;">
                <c:if test="${backlog.referSprint}" var="hasSprint">
                    <a href="${contextPath}/developer?currentSprint.guid=${backlog.sprint.guid}">${backlog.sprint.name}</a>
                </c:if>
                <c:if test="${not hasSprint}">
                    ...
                </c:if>
            </displaytag:column>
            <displaytag:column title="&nbsp;" style="vertical-align: middle;">
                <a href="javascript:void(0)" data-content="${backlog.htmlTip}" class="backlogDetails"><i
                        class="icon-info-sign"></i></a>
                <%--<a href="javascript:void(0);" title="Download the document(s)"><i class="icon-download"></i></a>--%>
            </displaytag:column>
        </displaytag:table>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        new BacklogOverview("${param.alert}");
    });
</script>
</body>
</html>